#pragma once

#include "DialLookAndFeel.h"
#include <JuceHeader.h>

namespace juce {
class LevelMeter : public Component, public Timer {
public:
    LevelMeter(std::function<float()>&& valueFunction)
        : valueSupplier(std::move(valueFunction))
    {
        startTimerHz(24);
    }

    void paint(Graphics& g) override;
    void resized() override;
    void timerCallback() override { repaint(); }
private:
    std::function<float()> valueSupplier;
    ColourGradient gradient {};
};

class LevelAlarm : public Component, public Timer {
public:
    LevelAlarm(std::function<float()>&& valueFunction)
        : valueSupplier(std::move(valueFunction))
    {
        startTimerHz(24);
    }

    void paint(Graphics& g) override;
    void timerCallback() override { repaint(); }
private:
    std::function<float()> valueSupplier;
};

class RoundLED : public Component {
public:
    RoundLED() = default;
    RoundLED(int state, Colour colour);

    void paint(Graphics& g) override;
    void setState(bool state);
private:
    bool state;
    Colour colour;
    Image redLedImage, greenLedImage;
};
}; // namespace juce
